package com.briup.jz.web.controller;

import com.briup.jz.bean.OrderLine;
import com.briup.jz.service.IOrderService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;
import com.briup.jz.vm.OrderVM;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: jz
 * @description: 订单管理
 * @author: charles
 * @create: 2020-06-12 11:43
 **/
@RestController
@RequestMapping("/order")
@Api(description = "订单管理接口")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @PostMapping("commit")
    @ApiOperation("提交订单")
    public Message commit(@RequestBody OrderVM orderVM){
        orderService.commit(orderVM);
        return MessageUtil.success("提交成功");
    }

    @ApiOperation("查看全部订单")
    @GetMapping("findAll")
    public Message findAll(){
        orderService.findAll();
        return MessageUtil.success("sucess",orderService.findAll());
    }
    @ApiOperation("通过ID搜索订单的详细信息")
    @GetMapping("findById")
    public Message findById(long id){
   /*     orderService.findOrderDetailsById(id);*/
        return MessageUtil.success("success",orderService.findOrderDetailsById(id));

    }

}

